package mpcs.utils.setting
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IOErrorEvent;
	import flash.events.SecurityErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	
	import mpcs.utils.xml.XMLUtils;

	public class Settings extends EventDispatcher {
		
		private  var settingsXML:XML=null;
		
		/**
		 *  地图属性设置类的构造器
		 *  根据目录地址加载xml文件
		 */		
		public function Settings( src:String = "data/settings.xml" ) {
			settingsXML = XMLUtils.loadXMLFile( src );
		}
		
		// =========== 以下是获取加载到的settingsXML中的键值 =============
		
		public  function get key():String {
			return settingsXML == null ?  "" : settingsXML.global.key[0].toString();
		}
		public  function get url():String {
			return settingsXML == null? "" : settingsXML.global.url[0].toString();
		}
		public function get x():Number {
			return settingsXML == null ? 0 : Number(settingsXML.info.x[0]);
		}
		public function get y():Number {
			return settingsXML == null ? 0 : Number(settingsXML.info.y[0]);
		}
	}
}